set(TARGET_TEST_LINK_LIBS xlcomm_base)

aux_source_directory(. NET_SRC)
aux_source_directory(./detail NET_DETAIL_SRC)
aux_source_directory(./poller NET_POLLER_SRC)
aux_source_directory(./http NET_HTTP_SRC)
aux_source_directory(./rpc NET_RPC_SRC)
add_library(xlcomm_net SHARED ${NET_SRC} ${NET_DETAIL_SRC} ${NET_POLLER_SRC} ${NET_HTTP_SRC} ${NET_RPC_SRC})

if(CMAKE_HOST_WIN32)
  target_compile_definitions(xlcomm_net PRIVATE XLCOMM_EXPORT)
else()
  set(TARGET_TEST_LINK_LIBS ${TARGET_TEST_LINK_LIBS} pthread protobuf)
endif()
target_link_libraries(xlcomm_net ${TARGET_TEST_LINK_LIBS})

add_subdirectory(protorpc)
add_subdirectory(test)
add_subdirectory(example)